#ifndef __SOCKDATA_H__
#define __SOCKDATA_H__

#include <string>
#include <queue>
#include <forward_list>
#include <string.h>

using std::string;
using std::queue;
using std::forward_list;

//static const int EPOLL_EVENT_MAX = 64;
//static const int MIN_READ_BUFFER = 64;

struct Uncomplete
{
    Uncomplete():header_(0),read_(-2){}
    unsigned short header_;
    short read_;
    string pack_;
};

struct ReadQueue
{
    queue<string> queue_;
    Uncomplete un_;

    void pushData(string &);
    void pushMore(char *buffer, uint16_t len);

    uint16_t readHeadSize(char *buffer);

    void reset_un();
};

class SocketIO
{
public:
	SocketIO();
    void filterData(char *buffer, uint16_t len);

    ReadQueue readQueue_;
	queue<string> writeQueue_;
};

#endif
